<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .outer {
        /* 设置宽度，没给高度，产品浮动的影响 */
        width: 400px;
        background-color: gray;
        /* 设置border可以解决子元素设置margin塌陷的问题 */
        border: 1px solid red;
      }
      .box {
        width: 100px;
        height: 100px;
        background-color: blue;
        border: 10px solid black;
        /* 设置margin上下margin合并 */
        margin: 10px;

        /* 浮动练习3 */
        float: left;
      }

      /* 浮动练习1 */
      /* .box1 {
        float: right;
      } */

      /* 浮动练习2 */
      /* .box1 {
        float: left;
        background: transparent;
      }
      .box2 {
        background-color: red;
      } */

      /* 浮动练习4 */
      .box1 {
        height: 150px;
      }
    </style>
  </head>
  <body>
    <div class="outer">
      <div class="box box1">1</div>
      <div class="box box2">2</div>
      <div class="box box3">3</div>
    </div>
  </body>
</html>
